<?php $this->_extends('_layouts/default_layout'); ?>
<?php $this->_block('contents'); ?>

<link href="<?php echo $_BASE_DIR; ?>plugins/uploadify/uploadify.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="<?php echo $_BASE_DIR; ?>plugins/xheditor/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="<?php echo $_BASE_DIR; ?>plugins/xheditor/xheditor-1.1.11-zh-cn.min.js "></script>
<script type="text/javascript" src="<?php echo $_BASE_DIR; ?>plugins/uploadify/swfobject.js"></script>
<script type="text/javascript" src="<?php echo $_BASE_DIR; ?>plugins/uploadify/jquery.uploadify.v2.1.4.min.js"></script>
<script type="text/javascript" src="<?php echo $_BASE_DIR; ?>js/la_common.js"></script>

<script type="text/javascript">
$(editorInit);
var editor;
</script>
<?php if($article->article_reject_reason): ?>
<strong><h2>文章退回原因：<?php echo $article->article_reject_reason; ?></h2></strong>
<?php endif; ?>
<form action="<?php echo url('article/edit'); ?>" method="post" name="mainform" enctype="multipart/form-data"
        onsubmit="
        if (this.article_topic.value == '') 
        { 
	    alert('请输入文章标题'); 
	    return false; 
        }
        else if(this.article_topic.value.length > 256)
        {
            alert('文章标题不能超过256个字符');
            return false;
        }
        else if(this.summary.value.length > 1024)
        {
            alert('文章摘要不能超过1024个字符');
            return false;
        }
        else
        {
            var content = editor.getSource();
            if(content == '')
            {
                alert('文章内容不能为空');
                return false;
            }
            var images = $('img', content);
            if(images.length > 0)
            {
                this.content_image.value = images[0].src;
            }
        }
        return true;
        "
>
    <label><h5>文章标题</h5></label>
    文章标题最好小于12个汉字，或者个24个英文字符，否则影响客户端显示效果</br>
    <input class="input" type="text" value="<?php echo $article->article_name; ?>"  name="article_topic" size="100%" /></br></br>
    <input class="input" type="hidden" value="" name="content_image" id="content_image" />
    <label><h5>文章摘要</h5></label>
    <textarea name="summary" cols=130 rows=5><?php echo $article->article_summary; ?></textarea></br></br>
    

    <div name="article_logo" id="article_logo">
    <label><h5>标题图片</h5></label>
    <input id="file_upload" type="file" name="Filedata" /> </p>
    <div id="filesUploaded" name="filesUploaded"> 
    <?php if ($article->article_icon): ?>
    <img src="<?php echo $article->article_icon; ?>" style="max-width:300px;">
    <input type='hidden' value="<?php echo $article->article_icon;?>" name=uploadpic/>
    <?php endif; ?>
    </div>
    <script type="text/javascript">
$(function() {
    $('#file_upload').uploadify({
        'uploader'  : '<?php echo $_BASE_DIR; ?>plugins/uploadify/uploadify.swf',
        'script'    : '<?php echo $_BASE_DIR; ?>plugins/uploadify/uploadify.php',
        'cancelImg' : '<?php echo $_BASE_DIR; ?>plugins/uploadify/cancel.png',
        'folder'    : '<?php echo $upload_dir; ?>',
        'removeCompleted' : true,
        'fileDesc'  : '图片文件',
        'fileExt'   : '*.jpg;*.bmp;*.png;*.gif',
        'sizeLimit' : 1024 * 1024 * 2,
        'onComplete': function(event, queueID, fileObj, response, data) 
            {
                while(filesUploaded.firstChild)
                {
                    var oldNode = filesUploaded.removeChild(filesUploaded.firstChild);
                    oldNode = null;
                }
                $('#filesUploaded').append('<img src='+response+' style="max-width:300px;"><input type=hidden value='+response+' name=uploadpic />');
            }
    }); });
    </script>
<a href="javascript:$('#file_upload').uploadifyUpload()">上传</a></br>
</div></br>
        <select name="article_column" >
            <?php foreach ($columns as $column): ?>
                <?php if($column->column_id == $column_id): ?>
                    <option value="<?php echo $column->id() ?>" id="<?php echo $column->id() ?>" selected = "selected"'>
                <?php else: ?>
                    <option value="<?php echo $column->id() ?>" id="<?php echo $column->id() ?>">
                <?php endif; ?>
                <?php echo $column->column_name; ?>
                </option>
            <?php endforeach; ?>
        </select>

        <label><h5>文章内容</h5></label>
        <textarea id="article_content" name="article_content" rows="15"><?php echo $article->article_content; ?></textarea>

<input type="hidden" value="<?php echo $article->article_id; ?>" name="article_id" id="<?php echo $article->article_id; ?>" />

        <?php if ($article->article_isbanner): ?>
        <label>作为banner</label><input type="checkbox" name="banner" checked="checked"/></br>
        <?php else: ?>
        <label>作为banner</label><input type="checkbox" name="banner" /></br>
        <?php endif; ?>
        <h3><font color="red">作为banner的文章图标最好为480x240否则会影响美观"</font></h3>
        <input type="submit" value="提交审核" name="submit">
        </form>

        <?php $this->_endblock(); ?>
